//
//  CLMessageForward.m
//  RuntimeTest
//
//  Created by Charles on 16/9/27.
//  Copyright © 2016年 Charles. All rights reserved.
//

#import "CLForwardMessage.h"
#import "CLAnimal.h"
#import "CLBird.h"
#import "CLDog.h"
#import <objc/message.h>

@implementation CLForwardMessage

+ (void)test{
    
    
    CLAnimal * animal = ((CLAnimal * (*)(id,SEL))objc_msgSend)((id)[CLAnimal class],@selector(alloc));
    animal = ((CLAnimal *(*)(id,SEL))objc_msgSend)((id)animal,@selector(init));

    ((void (*)(id,SEL))objc_msgSend)((id)animal,@selector(fly));
    
    /*
    CLBird * bird = ((CLBird *(*)(id,SEL))objc_msgSend)((id)[CLBird class],@selector(alloc));
    
    bird = ((CLBird *(*)(id,SEL))objc_msgSend)((id)bird,@selector(init));
    
    ((void (*)(id,SEL))objc_msgSend)((id)bird,@selector(lookDoor));

    
    CLDog * dog = ((CLDog *(*)(id,SEL))objc_msgSend)((id)[CLDog class],@selector(alloc));
    
    dog = ((CLDog *(*)(id,SEL))objc_msgSend)((id)dog,@selector(init));
    
    ((void (*)(id,SEL))objc_msgSend)((id)dog,@selector(fly));
     */
}

@end
